<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<!--
Not Automatically generated, changed!:
$Id: syntax_internal_functions_conversion.htm,v 1.4 2012/02/08 08:50:12 ianb1957 Exp $ 
-->
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Syntax - Conversion functions</title>
<link rel="stylesheet" type="text/css" href="../avisynth.css">
</head>
<body>
<h2><span class="mw-headline">AviSynth Syntax - Conversion functions</span></h2>
<p>Conversion functions convert between different types. There are also some <a href="syntax_internal_functions_numeric.htm" title="Internal functions/Numeric functions">numeric
functions</a> that can be classified in this category, namely: <tt>Ceil, Floor,
Float, Int</tt> and <tt>Round</tt>.</p>
<ul>
  <li><span style="color: rgb(0, 0, 128); font-weight: bold;">Value</span> <span>&nbsp;</span>
    | <span>&nbsp;</span> v2.07 <span>&nbsp;</span> | <span>&nbsp;</span> <span style="color: purple; font-weight: bold;">Value(string)</span></li>
</ul>
<dl>
  <dd>Converts a decimal string to its associated numeric value.</dd>
  <dd><i>Examples:</i></dd>
</dl>
<pre>Value (&quot;-2.7&quot;) = -2.7</pre>
<ul>
  <li><span style="color: rgb(0, 0, 128); font-weight: bold;">HexValue</span> <span>&nbsp;</span>
    | <span>&nbsp;</span> v2.07 <span>&nbsp;</span> | <span>&nbsp;</span> <span style="color: purple; font-weight: bold;">HexValue(string)</span></li>
</ul>
<dl>
  <dd>Converts a hexadecimal string to its associated numeric value.</dd>
  <dd><i>Examples:</i></dd>
</dl>
<pre>HexValue (&quot;FF00&quot;) = 65280</pre>
<ul>
  <li><span style="color: rgb(0, 0, 128); font-weight: bold;">Hex</span> <span>&nbsp;</span>
    | <span>&nbsp;</span> v2.60 <span>&nbsp;</span> | <span>&nbsp;</span> <span style="color: purple; font-weight: bold;">Hex(int)</span></li>
</ul>
<dl>
  <dd>Converts a numerical value to its hexadecimal value string. See <a href="http://avisynth.org/mediawiki/Colors" title="Colors">Colors</a>
    for more information on specifying colors.</dd>
  <dd><i>Examples:</i></dd>
</dl>
<pre>Hex (10824234) = &quot;A52A2A&quot;</pre>
<ul>
  <li><span style="color: rgb(0, 0, 128); font-weight: bold;">String</span> <span>&nbsp;</span>
    | <span>&nbsp;</span> v2.07 <span>&nbsp;</span> | <span>&nbsp;</span> <span style="color: purple; font-weight: bold;">String(float
    / int [, string format_string])</span></li>
</ul>
<dl>
  <dd>Converts a variable to a string.</dd>
  <dd>If the variable is float or integer, it first converts it to a float and
    then uses <span style="color: purple; font-weight: bold;">format_string</span>
    to convert the float to a string. The syntax of <span style="color: purple; font-weight: bold;">format_string</span>
    is as follows:</dd>
  <dd><tt>%[flags][width][.precision]f</tt></dd>
  <dd><i>width</i>: the minimum width (the string is never truncated)</dd>
  <dd><i>precision</i>: the number of digits printed</dd>
  <dd><i>flags</i>:
    <dl>
      <dd><tt>- </tt>left align (instead right align)</dd>
      <dd><tt>+ </tt>always print the +/- sign</dd>
      <dd><tt>0 </tt>padding with leading zeros</dd>
      <dd><tt>' '</tt> print a blank instead of a &quot;+&quot;</dd>
      <dd><tt># </tt>always print the decimal point</dd>
      <dt>&nbsp;</dt>
      <dt>You can also put arbitrary text around the format_string as defined
        above, similar to the C-language <i>printf</i> function.</dt>
    </dl>
    <p><i>Examples:</i>
  </dd>
</dl>
<pre><a href="corefilters/subtitle.htm" title="Subtitle">Subtitle</a>( &quot;Clip height is &quot; + String(last.height) )
Subtitle( String(x, &quot;Value of x is %.3f after AR calc&quot;) )
Subtitle( &quot;Value of x is &quot; + String(x, &quot;%.3f&quot;) + &quot; after AR calc&quot;) ) # same as above
String(1.23, &quot;%f&quot;) = '1.23'
String(1.23, &quot;%5.1f&quot;) = ' 1.2'
String(1.23, &quot;%1.3f&quot;) = '1.230'
String(24, &quot;%05.0f&quot;) = '00024'</pre>
<hr>
<p>Back to <a href="syntax_internal_functions.htm" title="Internal functions">Internal
functions</a>.</p>
<p><kbd>$Date: 2012/02/08 08:50:12 $</kbd></p>
</body>
</html>
